//
//  TJActivationCodeUseRecordCell.m
//  BaoDian
//
//  Created by mac on 2024/7/30.
//

#import "TJActivationCodeUseRecordCell.h"

@interface TJActivationCodeUseRecordCell()

@property (nonatomic, weak) UILabel *activationCodeLabel;
@property (nonatomic, weak) UILabel *specificationLabelValueLabel;
@property (nonatomic, weak) UILabel *dateValueLabel;
@property (nonatomic, weak) UILabel *userIdValueLabel;


@end

@implementation TJActivationCodeUseRecordCell

 
- (void)settingSubView {
    [super settingSubView];

    
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.backgroundColor = UIColor.tj_backgroundColor;
    
    UIView *tj_contentView = [UIView addToView:self.contentView];
    tj_contentView.backgroundColor = UIColor.tj_1E1F23Color;
    tj_contentView.addCornerRadius(12);
    [tj_contentView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.inset(16);
        make.top.offset(0);
    }];
    
    UIView *topView = [UIView addToView:tj_contentView];
    [topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.inset(0);
        make.top.offset(0);
        make.height.offset(54);
    }];
    
    UILabel *activationCodeLabel = [UILabel lableWithSuperView:topView font:UIFontSemiboldMake(24) color:UIColor.whiteColor title:nil textAlignment:NSTextAlignmentLeft];
    [activationCodeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.offset(0);
        make.left.offset(16);
    }];
 
    [topView addLineViewWithColor:UIColorMake(0x2D2D2D) block:^(MASConstraintMaker *make) {
        make.left.right.inset(16);
        make.bottom.offset(0);
        make.height.offset(1);
    }];
    
    UILabel *typeLabel = [UILabel lableWithSuperView:tj_contentView font:UIFontMake(14) color:UIColor.tj_8D9298Color title:@"激活码类型" textAlignment:NSTextAlignmentLeft];
    [typeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(topView.mas_bottom).offset(12);
        make.left.equalTo(activationCodeLabel);
    }];
    
    UILabel *typeValueLabel = [UILabel lableWithSuperView:tj_contentView font:UIFontMake(14) color:UIColor.whiteColor title:@"员工分组激活码" textAlignment:NSTextAlignmentLeft];
    [typeValueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(110);
        make.centerY.equalTo(typeLabel);
    }];
    
    UILabel *specificationLabel = [UILabel lableWithSuperView:tj_contentView font:UIFontMake(14) color:UIColor.tj_8D9298Color title:@"激活码规格" textAlignment:NSTextAlignmentLeft];
    [specificationLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(typeLabel.mas_bottom).offset(8);
        make.left.equalTo(activationCodeLabel);
    }];
    
    UILabel *specificationLabelValueLabel = [UILabel lableWithSuperView:tj_contentView font:UIFontMake(14) color:UIColor.whiteColor title:nil textAlignment:NSTextAlignmentLeft];
    [specificationLabelValueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(110);
        make.centerY.equalTo(specificationLabel);
    }];
    
    UILabel *dateLabel = [UILabel lableWithSuperView:tj_contentView font:UIFontMake(14) color:UIColor.tj_8D9298Color title:@"激活时间" textAlignment:NSTextAlignmentLeft];
    [dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(specificationLabel.mas_bottom).offset(8);
        make.left.equalTo(specificationLabel);
    }];
    
    UILabel *dateValueLabel = [UILabel lableWithSuperView:tj_contentView font:UIFontMake(14) color:UIColor.whiteColor title:nil textAlignment:NSTextAlignmentLeft];
    [dateValueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(110);
        make.centerY.equalTo(dateLabel);
    }];
    
    UILabel *userIdLabel = [UILabel lableWithSuperView:tj_contentView font:UIFontMake(14) color:UIColor.tj_8D9298Color title:@"使用ID" textAlignment:NSTextAlignmentLeft];
    [userIdLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(dateLabel.mas_bottom).offset(8);
        make.left.equalTo(dateLabel);
    }];
    
    UILabel *userIdValueLabel = [UILabel lableWithSuperView:tj_contentView font:UIFontMake(14) color:UIColor.whiteColor title:nil textAlignment:NSTextAlignmentLeft];
    [userIdValueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(110);
        make.centerY.equalTo(userIdLabel);
    }];
    
    _activationCodeLabel = activationCodeLabel;
    _specificationLabelValueLabel = specificationLabelValueLabel;
    _userIdValueLabel = userIdValueLabel;
    _dateValueLabel = dateValueLabel;
  
}

- (void)setModel:(TJActiveCodeModel *)model {
    _model = model;
    
    _dateValueLabel.text = model.updateDate;
    _userIdValueLabel.text = model.userId;
    _activationCodeLabel.text = model.activationCode;
    _specificationLabelValueLabel.text = [NSString stringWithFormat:@"%@天，%@人", model.validDays, model.times];
}

 
@end
